package com.guoxin.chapter2.t10;

/**
 * @author guoxin
 * @date 2019年8月21日
 */
public class PrintString implements Runnable {
	private boolean isContinuePrint = true;

	public void setContinuePrint(boolean isContinuePrint) {
		this.isContinuePrint = isContinuePrint;
	}

	public boolean isContinuePrint() {
		return isContinuePrint;
	}

	public void printStringMethod() {
		while (isContinuePrint) {
			try {
				System.out.println("run printStringMethod threadName=" + Thread.currentThread().getName());
				Thread.sleep(1000);
			} catch (InterruptedException e) {
				e.printStackTrace();
			}
		}
	}

	@Override
	public void run() {
		printStringMethod();
	}
}
